package com.liangzhong.model.buffer
{
	import com.liangzhong.constants.ResourceConst;
	import com.liangzhong.manager.ResourceManager;
	import com.liangzhong.model.buffer.vo.BufferVo;

	/**
	 * buffer 管理
	 * @author lake
	 * 
	 */	
	public class BufferManager
	{
		/**
		 *buffer 列表 
		 */		
		public var bufferList :Array = [];
		
		public function BufferManager()
		{
		}
		/**
		 *解析列表 
		 */		
		public function parseBufferList():void
		{
			var xmlBuffer:XML = ResourceManager.instance.getResource(ResourceConst.BUFFER);
			var bufferVo :BufferVo;
			for each(var item:XML in xmlBuffer.tb_buffer)
			{
				bufferVo = new BufferVo();
				bufferVo.parse(item);
				bufferList.push(bufferVo);
			}
		}
		/**
		 *根据id得到buffer 信息 
		 * @param buffid
		 * @return 
		 * 
		 */		
		public function getBufferById(buffid :int):BufferVo
		{
			for each(var bufferVo :BufferVo in bufferList)
			{
				if(bufferVo.buffid == buffid)
				{
					return bufferVo; 
				}
			}
			return null;
		}
	}
}